{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy import *\n",
    "from galgebra.printer import Format, latex, Fmt, GaLatexPrinter\n",
    "Format()\n",
    "from galgebra.ga import Ga\n",
    "from galgebra.mv import ONE, ZERO, HALF"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "def dot_basis_r_basis(ga):\n",
    "    return [ga.dot(ga.basis[i], ga.r_basis[i]) for i in ga.n_range]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "def gg(ga):\n",
    "    return simplify(ga.g * ga.g_inv)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "def conv_christoffel_symbols(cf):\n",
    "    return permutedims(Array(cf), (2, 0, 1))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "def show_christoffel_symbols(ga):\n",
    "    if ga.connect_flg:\n",
    "        display(conv_christoffel_symbols(ga.Christoffel_symbols(mode=1)))\n",
    "        display(conv_christoffel_symbols(ga.Christoffel_symbols(mode=2)))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Minkowski Spacetime Metric"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "coord = symbols('t x y z')\n",
    "metric = Matrix([\n",
    "                [ 1, 0, 0, 0 ], \n",
    "                [ 0, -1, 0, 0 ], \n",
    "                [ 0, 0, -1, 0 ], \n",
    "                [ 0, 0, 0, -1 ]\n",
    "            ])\n",
    "minkowski = Ga('e', g=metric, coords=coord, norm=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[ \\mathbf{e_{t}}, \\  \\mathbf{e_{x}}, \\  \\mathbf{e_{y}}, \\  \\mathbf{e_{z}}\\right]$"
      ],
      "text/plain": [
       "[eₜ, eₓ, e_y, e_z]"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# NBVAL_IGNORE_OUTPUT\n",
    "minkowski.basis"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}1 & 0 & 0 & 0\\\\0 & -1 & 0 & 0\\\\0 & 0 & -1 & 0\\\\0 & 0 & 0 & -1\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "Matrix([\n",
       "[1,  0,  0,  0],\n",
       "[0, -1,  0,  0],\n",
       "[0,  0, -1,  0],\n",
       "[0,  0,  0, -1]])"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "minkowski.g"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[ 1, \\  1, \\  1, \\  1\\right]$"
      ],
      "text/plain": [
       "[1, 1, 1, 1]"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dot_basis_r_basis(minkowski)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}1 & 0 & 0 & 0\\\\0 & 1 & 0 & 0\\\\0 & 0 & 1 & 0\\\\0 & 0 & 0 & 1\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "⎡1  0  0  0⎤\n",
       "⎢          ⎥\n",
       "⎢0  1  0  0⎥\n",
       "⎢          ⎥\n",
       "⎢0  0  1  0⎥\n",
       "⎢          ⎥\n",
       "⎣0  0  0  1⎦"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "gg(minkowski)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Kerr-Debney Metric"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "g4coords = (u, x, y, z) = symbols(\"u x y z\")\n",
    "g = Matrix([\n",
    "    [0, 0, -exp(-z), 0],\n",
    "    [0, HALF * u ** 2 * exp(4 * z), 0, 0],\n",
    "    [-exp(-z), 0, 12 * exp(-2 * z), u * exp(-z)],\n",
    "    [0, 0, u * exp(-z), HALF * u ** 2],\n",
    "])\n",
    "g4 = Ga('e', g=g, coords=g4coords, norm=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[ \\mathbf{e_{u}}, \\  \\mathbf{e_{x}}, \\  \\mathbf{e_{y}}, \\  \\mathbf{e_{z}}\\right]$"
      ],
      "text/plain": [
       "[eᵤ, eₓ, e_y, e_z]"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "g4.basis"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}0 & 0 & - e^{- z} & 0\\\\0 & \\frac{u^{2} e^{4 z}}{2} & 0 & 0\\\\- e^{- z} & 0 & 12 e^{- 2 z} & u e^{- z}\\\\0 & 0 & u e^{- z} & \\frac{u^{2}}{2}\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "Matrix([\n",
       "[       0,               0,     -exp(-z),         0],\n",
       "[       0, u**2*exp(4*z)/2,            0,         0],\n",
       "[-exp(-z),               0, 12*exp(-2*z), u*exp(-z)],\n",
       "[       0,               0,    u*exp(-z),    u**2/2]])"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "g4.g"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle - \\frac{u^{4} e^{2 z}}{4}$"
      ],
      "text/plain": [
       "  4  2⋅z \n",
       "-u ⋅ℯ    \n",
       "─────────\n",
       "    4    "
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "g4.e_sq"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[ - \\frac{u^{4} e^{2 z}}{4}, \\  - \\frac{u^{4} e^{2 z}}{4}, \\  - \\frac{u^{4} e^{2 z}}{4}, \\  - \\frac{u^{4} e^{2 z}}{4}\\right]$"
      ],
      "text/plain": [
       "⎡  4  2⋅z     4  2⋅z     4  2⋅z     4  2⋅z ⎤\n",
       "⎢-u ⋅ℯ      -u ⋅ℯ      -u ⋅ℯ      -u ⋅ℯ    ⎥\n",
       "⎢─────────, ─────────, ─────────, ─────────⎥\n",
       "⎣    4          4          4          4    ⎦"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dot_basis_r_basis(g4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}1 & 0 & 0 & 0\\\\0 & 1 & 0 & 0\\\\0 & 0 & 1 & 0\\\\0 & 0 & 0 & 1\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "⎡1  0  0  0⎤\n",
       "⎢          ⎥\n",
       "⎢0  1  0  0⎥\n",
       "⎢          ⎥\n",
       "⎢0  0  1  0⎥\n",
       "⎢          ⎥\n",
       "⎣0  0  0  1⎦"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "gg(g4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}\\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0 & - \\frac{u e^{4 z}}{2} & 0 & 0\\\\0 & 0 & 0 & 0\\\\0 & 0 & 0 & - \\frac{u}{2}\\end{matrix}\\right] & \\left[\\begin{matrix}0 & \\frac{u e^{4 z}}{2} & 0 & 0\\\\\\frac{u e^{4 z}}{2} & 0 & 0 & u^{2} e^{4 z}\\\\0 & 0 & 0 & 0\\\\0 & u^{2} e^{4 z} & 0 & 0\\end{matrix}\\right] & \\left[\\begin{matrix}0 & 0 & 0 & e^{- z}\\\\0 & 0 & 0 & 0\\\\0 & 0 & 0 & - 12 e^{- 2 z}\\\\e^{- z} & 0 & - 12 e^{- 2 z} & - u e^{- z}\\end{matrix}\\right] & \\left[\\begin{matrix}0 & 0 & 0 & \\frac{u}{2}\\\\0 & - u^{2} e^{4 z} & 0 & 0\\\\0 & 0 & 12 e^{- 2 z} & 0\\\\\\frac{u}{2} & 0 & 0 & 0\\end{matrix}\\right]\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "⎡                       ⎡           4⋅z             ⎤                         \n",
       "⎢⎡0     0      0   0 ⎤  ⎢        u⋅ℯ                ⎥                         \n",
       "⎢⎢                   ⎥  ⎢  0     ──────   0     0   ⎥  ⎡                      \n",
       "⎢⎢       4⋅z         ⎥  ⎢          2                ⎥  ⎢ 0   0      0         \n",
       "⎢⎢   -u⋅ℯ            ⎥  ⎢                           ⎥  ⎢                      \n",
       "⎢⎢0  ────────  0   0 ⎥  ⎢   4⋅z                     ⎥  ⎢ 0   0      0         \n",
       "⎢⎢      2            ⎥  ⎢u⋅ℯ                  2  4⋅z⎥  ⎢                      \n",
       "⎢⎢                   ⎥  ⎢──────     0     0  u ⋅ℯ   ⎥  ⎢                      \n",
       "⎢⎢0     0      0   0 ⎥  ⎢  2                        ⎥  ⎢ 0   0      0      -12\n",
       "⎢⎢                   ⎥  ⎢                           ⎥  ⎢                      \n",
       "⎢⎢                -u ⎥  ⎢  0        0     0     0   ⎥  ⎢ -z          -2⋅z     \n",
       "⎢⎢0     0      0  ───⎥  ⎢                           ⎥  ⎣ℯ    0  -12⋅ℯ       -u\n",
       "⎢⎣                 2 ⎦  ⎢         2  4⋅z            ⎥                         \n",
       "⎣                       ⎣  0     u ⋅ℯ     0     0   ⎦                         \n",
       "\n",
       "                                   ⎤\n",
       "         ⎡                       u⎤⎥\n",
       " -z   ⎤  ⎢0     0         0      ─⎥⎥\n",
       "ℯ     ⎥  ⎢                       2⎥⎥\n",
       "      ⎥  ⎢                        ⎥⎥\n",
       " 0    ⎥  ⎢     2  4⋅z             ⎥⎥\n",
       "      ⎥  ⎢0  -u ⋅ℯ        0      0⎥⎥\n",
       "  -2⋅z⎥  ⎢                        ⎥⎥\n",
       "⋅ℯ    ⎥  ⎢                 -2⋅z   ⎥⎥\n",
       "      ⎥  ⎢0     0      12⋅ℯ      0⎥⎥\n",
       "  -z  ⎥  ⎢                        ⎥⎥\n",
       "⋅ℯ    ⎦  ⎢u                       ⎥⎥\n",
       "         ⎢─     0         0      0⎥⎥\n",
       "         ⎣2                       ⎦⎦"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}\\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0 & 3 u e^{4 z} & 0 & 0\\\\0 & 0 & \\frac{24 e^{- 2 z}}{u} & 12 e^{- z}\\\\0 & 0 & 12 e^{- z} & 6 u\\end{matrix}\\right] & \\left[\\begin{matrix}0 & \\frac{1}{u} & 0 & 0\\\\\\frac{1}{u} & 0 & 0 & 2\\\\0 & 0 & 0 & 0\\\\0 & 2 & 0 & 0\\end{matrix}\\right] & \\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0 & \\frac{u e^{5 z}}{2} & 0 & 0\\\\0 & 0 & 0 & 0\\\\0 & 0 & 0 & \\frac{u e^{z}}{2}\\end{matrix}\\right] & \\left[\\begin{matrix}0 & 0 & 0 & \\frac{1}{u}\\\\0 & - 3 e^{4 z} & 0 & 0\\\\0 & 0 & \\frac{24 e^{- 2 z}}{u^{2}} & 0\\\\\\frac{1}{u} & 0 & 0 & -1\\end{matrix}\\right]\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "⎡                                                                     ⎡       \n",
       "⎢                                                                     ⎢0     0\n",
       "⎢⎡0     0         0        0   ⎤                ⎡0    0     0   0  ⎤  ⎢       \n",
       "⎢⎢                             ⎥  ⎡   1      ⎤  ⎢                  ⎥  ⎢       \n",
       "⎢⎢        4⋅z                  ⎥  ⎢0  ─  0  0⎥  ⎢      5⋅z         ⎥  ⎢       \n",
       "⎢⎢0  3⋅u⋅ℯ        0        0   ⎥  ⎢   u      ⎥  ⎢   u⋅ℯ            ⎥  ⎢0  -3⋅ℯ\n",
       "⎢⎢                             ⎥  ⎢          ⎥  ⎢0  ──────  0   0  ⎥  ⎢       \n",
       "⎢⎢                 -2⋅z        ⎥  ⎢1         ⎥  ⎢     2            ⎥  ⎢       \n",
       "⎢⎢             24⋅ℯ          -z⎥  ⎢─  0  0  2⎥  ⎢                  ⎥  ⎢       \n",
       "⎢⎢0     0      ────────  12⋅ℯ  ⎥  ⎢u         ⎥  ⎢0    0     0   0  ⎥  ⎢0     0\n",
       "⎢⎢                u            ⎥  ⎢          ⎥  ⎢                  ⎥  ⎢       \n",
       "⎢⎢                             ⎥  ⎢0  0  0  0⎥  ⎢                 z⎥  ⎢       \n",
       "⎢⎢                  -z         ⎥  ⎢          ⎥  ⎢              u⋅ℯ ⎥  ⎢       \n",
       "⎢⎣0     0       12⋅ℯ      6⋅u  ⎦  ⎣0  2  0  0⎦  ⎢0    0     0  ────⎥  ⎢1      \n",
       "⎢                                               ⎣               2  ⎦  ⎢─     0\n",
       "⎣                                                                     ⎣u      \n",
       "\n",
       "               1 ⎤⎤\n",
       "        0      ─ ⎥⎥\n",
       "               u ⎥⎥\n",
       "                 ⎥⎥\n",
       "4⋅z              ⎥⎥\n",
       "        0      0 ⎥⎥\n",
       "                 ⎥⎥\n",
       "         -2⋅z    ⎥⎥\n",
       "     24⋅ℯ        ⎥⎥\n",
       "     ────────  0 ⎥⎥\n",
       "         2       ⎥⎥\n",
       "        u        ⎥⎥\n",
       "                 ⎥⎥\n",
       "                 ⎥⎥\n",
       "        0      -1⎥⎥\n",
       "                 ⎦⎦"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "show_christoffel_symbols(g4)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Schwarzschild Metric"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "G, M, c = symbols('G M c')\n",
    "coords = (x0, x1, x2, x3) = symbols(\"t r theta phi\")\n",
    "g = Matrix([    \n",
    "        [ (1-(2*G*M)/(x1*c**2)), 0, 0, 0 ], \n",
    "        [ 0, - (1-(2*G*M)/(x1*c**2))**(-1), 0, 0 ], \n",
    "        [ 0, 0, - x1**2, 0 ], \n",
    "        [ 0, 0, 0, - x1**2*sin(x2)**2 ]\n",
    "    ])\n",
    "schwarzschild = Ga('e', g=g, coords=coords, norm=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[ \\mathbf{e_{t}}, \\  \\mathbf{e_{r}}, \\  \\mathbf{e_{\\theta}}, \\  \\mathbf{e_{\\phi}}\\right]$"
      ],
      "text/plain": [
       "[eₜ, eᵣ, eₜₕₑₜₐ, eᵩ]"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# NBVAL_IGNORE_OUTPUT\n",
    "schwarzschild.basis"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}- \\frac{2 G M}{c^{2} r} + 1 & 0 & 0 & 0\\\\0 & - \\frac{1}{- \\frac{2 G M}{c^{2} r} + 1} & 0 & 0\\\\0 & 0 & - r^{2} & 0\\\\0 & 0 & 0 & - r^{2} \\sin^{2}{\\left(\\theta \\right)}\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "Matrix([\n",
       "[-2*G*M/(c**2*r) + 1,                        0,     0,                   0],\n",
       "[                  0, -1/(-2*G*M/(c**2*r) + 1),     0,                   0],\n",
       "[                  0,                        0, -r**2,                   0],\n",
       "[                  0,                        0,     0, -r**2*sin(theta)**2]])"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "schwarzschild.g"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle - r^{4} \\sin^{2}{\\left(\\theta \\right)}$"
      ],
      "text/plain": [
       "  4    2   \n",
       "-r ⋅sin (θ)"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "schwarzschild.e_sq"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[ 1, \\  - \\frac{\\frac{2 G M}{c^{2} r} - 1}{- \\frac{2 G M}{c^{2} r} + 1}, \\  1, \\  1\\right]$"
      ],
      "text/plain": [
       "⎡    ⎛2⋅G⋅M    ⎞       ⎤\n",
       "⎢   -⎜───── - 1⎟       ⎥\n",
       "⎢    ⎜  2      ⎟       ⎥\n",
       "⎢    ⎝ c ⋅r    ⎠       ⎥\n",
       "⎢1, ─────────────, 1, 1⎥\n",
       "⎢      2⋅G⋅M           ⎥\n",
       "⎢    - ───── + 1       ⎥\n",
       "⎢        2             ⎥\n",
       "⎣       c ⋅r           ⎦"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dot_basis_r_basis(schwarzschild)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}1 & 0 & 0 & 0\\\\0 & 1 & 0 & 0\\\\0 & 0 & 1 & 0\\\\0 & 0 & 0 & 1\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "⎡1  0  0  0⎤\n",
       "⎢          ⎥\n",
       "⎢0  1  0  0⎥\n",
       "⎢          ⎥\n",
       "⎢0  0  1  0⎥\n",
       "⎢          ⎥\n",
       "⎣0  0  0  1⎦"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "gg(schwarzschild)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}\\left[\\begin{matrix}0 & \\frac{G M}{c^{2} r^{2}} & 0 & 0\\\\\\frac{G M}{c^{2} r^{2}} & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\end{matrix}\\right] & \\left[\\begin{matrix}- \\frac{G M}{c^{2} r^{2}} & 0 & 0 & 0\\\\0 & \\frac{G M c^{2}}{4 G^{2} M^{2} + c^{2} r \\left(- 4 G M + c^{2} r\\right)} & 0 & 0\\\\0 & 0 & r & 0\\\\0 & 0 & 0 & r \\sin^{2}{\\left(\\theta \\right)}\\end{matrix}\\right] & \\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0 & 0 & - r & 0\\\\0 & - r & 0 & 0\\\\0 & 0 & 0 & \\frac{r^{2} \\sin{\\left(2 \\theta \\right)}}{2}\\end{matrix}\\right] & \\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0 & 0 & 0 & - r \\sin^{2}{\\left(\\theta \\right)}\\\\0 & 0 & 0 & - \\frac{r^{2} \\sin{\\left(2 \\theta \\right)}}{2}\\\\0 & - r \\sin^{2}{\\left(\\theta \\right)} & - \\frac{r^{2} \\sin{\\left(2 \\theta \\right)}}{2} & 0\\end{matrix}\\right]\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "⎡                      ⎡-G⋅M                                               ⎤  \n",
       "⎢⎡        G⋅M       ⎤  ⎢─────                0                 0      0    ⎥  \n",
       "⎢⎢  0    ─────  0  0⎥  ⎢ 2  2                                              ⎥  \n",
       "⎢⎢        2  2      ⎥  ⎢c ⋅r                                               ⎥  \n",
       "⎢⎢       c ⋅r       ⎥  ⎢                                                   ⎥  \n",
       "⎢⎢                  ⎥  ⎢                        2                          ⎥  \n",
       "⎢⎢ G⋅M              ⎥  ⎢                   G⋅M⋅c                           ⎥  \n",
       "⎢⎢─────    0    0  0⎥  ⎢  0    ──────────────────────────────  0      0    ⎥  \n",
       "⎢⎢ 2  2             ⎥  ⎢          2  2    2   ⎛          2  ⎞              ⎥  \n",
       "⎢⎢c ⋅r              ⎥  ⎢       4⋅G ⋅M  + c ⋅r⋅⎝-4⋅G⋅M + c ⋅r⎠              ⎥  \n",
       "⎢⎢                  ⎥  ⎢                                                   ⎥  \n",
       "⎢⎢  0      0    0  0⎥  ⎢  0                  0                 r      0    ⎥  \n",
       "⎢⎢                  ⎥  ⎢                                                   ⎥  \n",
       "⎢⎣  0      0    0  0⎦  ⎢                                               2   ⎥  \n",
       "⎣                      ⎣  0                  0                 0  r⋅sin (θ)⎦  \n",
       "\n",
       "                          ⎡0      0             0              0      ⎤⎤\n",
       "                          ⎢                                           ⎥⎥\n",
       "⎡0  0   0        0     ⎤  ⎢                                     2     ⎥⎥\n",
       "⎢                      ⎥  ⎢0      0             0         -r⋅sin (θ)  ⎥⎥\n",
       "⎢0  0   -r       0     ⎥  ⎢                                           ⎥⎥\n",
       "⎢                      ⎥  ⎢                                2          ⎥⎥\n",
       "⎢0  -r  0        0     ⎥  ⎢                              -r ⋅sin(2⋅θ) ⎥⎥\n",
       "⎢                      ⎥  ⎢0      0             0        ─────────────⎥⎥\n",
       "⎢            2         ⎥  ⎢                                    2      ⎥⎥\n",
       "⎢           r ⋅sin(2⋅θ)⎥  ⎢                                           ⎥⎥\n",
       "⎢0  0   0   ───────────⎥  ⎢                 2                         ⎥⎥\n",
       "⎣                2     ⎦  ⎢         2     -r ⋅sin(2⋅θ)                ⎥⎥\n",
       "                          ⎢0  -r⋅sin (θ)  ─────────────        0      ⎥⎥\n",
       "                          ⎣                     2                     ⎦⎥\n",
       "                                                                       ⎦"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}\\left[\\begin{matrix}0 & \\frac{G M}{r \\left(- 2 G M + c^{2} r\\right)} & 0 & 0\\\\\\frac{G M}{r \\left(- 2 G M + c^{2} r\\right)} & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\end{matrix}\\right] & \\left[\\begin{matrix}\\frac{G M \\left(- 2 G M + c^{2} r\\right)}{c^{4} r^{3}} & 0 & 0 & 0\\\\0 & \\frac{G M}{r \\left(2 G M - c^{2} r\\right)} & 0 & 0\\\\0 & 0 & \\frac{2 G M}{c^{2}} - r & 0\\\\0 & 0 & 0 & \\frac{\\left(2 G M - c^{2} r\\right) \\sin^{2}{\\left(\\theta \\right)}}{c^{2}}\\end{matrix}\\right] & \\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0 & 0 & \\frac{1}{r} & 0\\\\0 & \\frac{1}{r} & 0 & 0\\\\0 & 0 & 0 & - \\frac{\\sin{\\left(2 \\theta \\right)}}{2}\\end{matrix}\\right] & \\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0 & 0 & 0 & \\frac{1}{r}\\\\0 & 0 & 0 & \\frac{1}{\\tan{\\left(\\theta \\right)}}\\\\0 & \\frac{1}{r} & \\frac{1}{\\tan{\\left(\\theta \\right)}} & 0\\end{matrix}\\right]\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "⎡                                              ⎡    ⎛          2  ⎞           \n",
       "⎢                                              ⎢G⋅M⋅⎝-2⋅G⋅M + c ⋅r⎠           \n",
       "⎢                                              ⎢───────────────────         0 \n",
       "⎢                                              ⎢        4  3                  \n",
       "⎢⎡                          G⋅M             ⎤  ⎢       c ⋅r                   \n",
       "⎢⎢        0          ─────────────────  0  0⎥  ⎢                              \n",
       "⎢⎢                     ⎛          2  ⎞      ⎥  ⎢                           G⋅M\n",
       "⎢⎢                   r⋅⎝-2⋅G⋅M + c ⋅r⎠      ⎥  ⎢         0           ─────────\n",
       "⎢⎢                                          ⎥  ⎢                       ⎛      \n",
       "⎢⎢       G⋅M                                ⎥  ⎢                     r⋅⎝2⋅G⋅M \n",
       "⎢⎢─────────────────          0          0  0⎥  ⎢                              \n",
       "⎢⎢  ⎛          2  ⎞                         ⎥  ⎢                              \n",
       "⎢⎢r⋅⎝-2⋅G⋅M + c ⋅r⎠                         ⎥  ⎢         0                  0 \n",
       "⎢⎢                                          ⎥  ⎢                              \n",
       "⎢⎢        0                  0          0  0⎥  ⎢                              \n",
       "⎢⎢                                          ⎥  ⎢                              \n",
       "⎢⎣        0                  0          0  0⎦  ⎢                              \n",
       "⎢                                              ⎢                              \n",
       "⎢                                              ⎢         0                  0 \n",
       "⎢                                              ⎢                              \n",
       "⎣                                              ⎣                              \n",
       "\n",
       "                                          ⎤                                   \n",
       "                                          ⎥                                   \n",
       "             0                0           ⎥                                   \n",
       "                                          ⎥                                   \n",
       "                                          ⎥  ⎡0  0  0      0     ⎤  ⎡0  0    0\n",
       "                                          ⎥  ⎢                   ⎥  ⎢         \n",
       "                                          ⎥  ⎢      1            ⎥  ⎢         \n",
       "───────      0                0           ⎥  ⎢0  0  ─      0     ⎥  ⎢0  0    0\n",
       "   2  ⎞                                   ⎥  ⎢      r            ⎥  ⎢         \n",
       "- c ⋅r⎠                                   ⎥  ⎢                   ⎥  ⎢         \n",
       "                                          ⎥  ⎢   1               ⎥  ⎢         \n",
       "         2⋅G⋅M                            ⎥  ⎢0  ─  0      0     ⎥  ⎢0  0    0\n",
       "         ───── - r            0           ⎥  ⎢   r               ⎥  ⎢         \n",
       "            2                             ⎥  ⎢                   ⎥  ⎢         \n",
       "           c                              ⎥  ⎢         -sin(2⋅θ) ⎥  ⎢   1    1\n",
       "                                          ⎥  ⎢0  0  0  ──────────⎥  ⎢0  ─  ───\n",
       "                    ⎛         2  ⎞    2   ⎥  ⎣             2     ⎦  ⎣   r  tan\n",
       "                    ⎝2⋅G⋅M - c ⋅r⎠⋅sin (θ)⎥                                   \n",
       "             0      ──────────────────────⎥                                   \n",
       "                               2          ⎥                                   \n",
       "                              c           ⎦                                   \n",
       "\n",
       "            ⎤\n",
       "            ⎥\n",
       "            ⎥\n",
       "            ⎥\n",
       "       0   ⎤⎥\n",
       "           ⎥⎥\n",
       "       1   ⎥⎥\n",
       "       ─   ⎥⎥\n",
       "       r   ⎥⎥\n",
       "           ⎥⎥\n",
       "       1   ⎥⎥\n",
       "     ──────⎥⎥\n",
       "     tan(θ)⎥⎥\n",
       "           ⎥⎥\n",
       "           ⎥⎥\n",
       "───    0   ⎥⎥\n",
       "(θ)        ⎦⎥\n",
       "            ⎥\n",
       "            ⎥\n",
       "            ⎥\n",
       "            ⎦"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "show_christoffel_symbols(schwarzschild)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
